<script setup>
import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import { isLoggedIn, getUserInfo, logout } from '../utils/auth.js'

const router = useRouter()
const userInfo = ref(null)
const isUserLoggedIn = ref(false)

// 搜索相关状态
const searchType = ref('hotel') // hotel, flight, train, bus
const checkInDate = ref('')
const checkOutDate = ref('')
const destination = ref('')
const guestCount = ref(1)

// 火车票相关状态
const departureCity = ref('上海')
const arrivalCity = ref('北京')
const trainDate = ref('')
const adultCount = ref(1)
const childCount = ref(0)
const trainType = ref('高铁/动车') // 高铁/动车, 普通列车
const isStudentTicket = ref(false)

// 功能分类数据
const categories = ref([
  { id: 'hotel', name: '酒店', icon: '🏨', color: '#FF6B6B' },
  { id: 'flight', name: '机票', icon: '✈️', color: '#4ECDC4' },
  { id: 'train', name: '火车票', icon: '🚄', color: '#45B7D1' },
  { id: 'bus', name: '汽车票', icon: '🚌', color: '#96CEB4' },
  { id: 'travel', name: '旅游', icon: '🏖️', color: '#FFEAA7' },
  { id: 'car', name: '租车', icon: '🚗', color: '#DDA0DD' },
  { id: 'insurance', name: '保险', icon: '🛡️', color: '#98D8C8' },
  { id: 'visa', name: '签证', icon: '📋', color: '#F7DC6F' }
])

// 热门目的地数据
const hotDestinations = ref([
  { name: '北京', image: '🏛️', price: '¥299起' },
  { name: '上海', image: '🏙️', price: '¥399起' },
  { name: '杭州', image: '🏞️', price: '¥199起' },
  { name: '成都', image: '🐼', price: '¥259起' },
  { name: '三亚', image: '🏖️', price: '¥599起' },
  { name: '厦门', image: '🌊', price: '¥329起' }
])

// 优惠活动数据
const promotions = ref([
  { title: '新用户专享', desc: '首单立减50元', color: '#FF6B6B', icon: '🎁' },
  { title: '会员特权', desc: '积分兑换好礼', color: '#4ECDC4', icon: '👑' },
  { title: '限时特惠', desc: '酒店5折起', color: '#45B7D1', icon: '⏰' }
])

// 服务保障数据
const guarantees = ref([
  { title: '安全保障', desc: '平台担保', icon: '🛡️' },
  { title: '价格保障', desc: '低价承诺', icon: '💰' },
  { title: '服务保障', desc: '7×24小时服务', icon: '🎯' },
  { title: '退改保障', desc: '灵活退改', icon: '✅' }
])

onMounted(() => {
  checkLoginStatus()
  // 设置默认日期
  const today = new Date()
  const tomorrow = new Date(today)
  tomorrow.setDate(tomorrow.getDate() + 1)
  
  checkInDate.value = formatDate(today)
  checkOutDate.value = formatDate(tomorrow)
  trainDate.value = formatDate(tomorrow)
})

const formatDate = (date) => {
  return date.toISOString().split('T')[0]
}

const checkLoginStatus = () => {
  isUserLoggedIn.value = isLoggedIn()
  if (isUserLoggedIn.value) {
    userInfo.value = getUserInfo()
  }
}

const handleLogin = () => {
  router.push('/user/login')
}

const handleLogout = () => {
  logout()
  isUserLoggedIn.value = false
  userInfo.value = null
}

const switchSearchType = (type) => {
  searchType.value = type
}

const searchHotels = () => {
  // 跳转到酒店列表页面
  router.push('/hotels')
}

// 交换出发和到达城市
const swapCities = () => {
  const temp = departureCity.value
  departureCity.value = arrivalCity.value
  arrivalCity.value = temp
}

// 格式化日期显示（用于火车票）
const formatTrainDate = (dateStr) => {
  if (!dateStr) return ''
  const date = new Date(dateStr)
  const month = date.getMonth() + 1
  const day = date.getDate()
  const today = new Date()
  const tomorrow = new Date(today)
  tomorrow.setDate(tomorrow.getDate() + 1)
  
  let dayLabel = ''
  if (dateStr === formatDate(today)) {
    dayLabel = '今天出发'
  } else if (dateStr === formatDate(tomorrow)) {
    dayLabel = '明天出发'
  } else {
    dayLabel = '出发'
  }
  
  return `${month}月${day}日 ${dayLabel}`
}

// 搜索火车票
const searchTrains = () => {
  // 跳转到火车票查询结果页面
  router.push({
    name: 'train-search',
    query: {
      departureCity: departureCity.value,
      arrivalCity: arrivalCity.value,
      trainDate: trainDate.value,
      adultCount: adultCount.value,
      childCount: childCount.value,
      trainType: trainType.value,
      isStudentTicket: isStudentTicket.value
    }
  })
}

const goToCategory = (categoryId) => {
  if (categoryId === 'hotel') {
    router.push('/hotels')
  } else {
    console.log('跳转到分类:', categoryId)
    // 这里可以添加其他分类的路由跳转逻辑
  }
}

</script>

<template>
  <div class="tongcheng-homepage">
    <!-- 顶部状态栏 -->
    <div class="status-bar">
      <div class="status-content">
        <div class="location">
          <span class="location-icon">📍</span>
          <span class="location-text">北京</span>
        </div>
        <div class="weather">
          <span class="weather-icon">☀️</span>
          <span class="weather-text">晴 25°C</span>
        </div>
      </div>
    </div>

    <!-- 顶部导航栏 -->
    <header class="top-header">
      <div class="header-content">
        <div class="logo-section">
          <div class="logo">
            <span class="logo-icon">🌐</span>
            <span class="logo-text">同程旅行</span>
          </div>
        </div>
        
        <div class="user-section">
          <div v-if="isUserLoggedIn" class="user-info">
            <div class="user-avatar">
              <img v-if="userInfo?.avatar_url" :src="userInfo.avatar_url" :alt="userInfo.nickname" />
              <div v-else class="default-avatar">
                {{ userInfo?.nickname?.charAt(0) || 'U' }}
              </div>
            </div>
            <span class="user-name">{{ userInfo?.nickname || '用户' }}</span>
          </div>
          <div v-else class="login-section">
            <button class="login-btn" @click="handleLogin">登录</button>
          </div>
        </div>
      </div>
    </header>

    <!-- 功能分类导航 -->
    <section class="category-nav">
      <div class="nav-content">
        <div 
          v-for="category in categories" 
          :key="category.id"
          class="category-item"
          @click="goToCategory(category.id)"
        >
          <div class="category-icon" :style="{ backgroundColor: category.color }">
            {{ category.icon }}
          </div>
          <span class="category-name">{{ category.name }}</span>
        </div>
      </div>
    </section>

    <!-- 酒店搜索核心区域 -->
    <section class="search-section">
      <div class="search-container">
        <div class="search-tabs">
          <button 
            v-for="type in ['hotel', 'flight', 'train', 'bus']" 
            :key="type"
            :class="['tab-btn', { active: searchType === type }]"
            @click="switchSearchType(type)"
          >
            {{ type === 'hotel' ? '酒店' : type === 'flight' ? '机票' : type === 'train' ? '火车票' : '汽车票' }}
          </button>
        </div>

        <!-- 酒店搜索表单 -->
        <div v-if="searchType !== 'train'" class="search-form">
          <!-- 目的地输入 -->
          <div class="search-field destination-field">
            <div class="field-icon">📍</div>
            <input 
              v-model="destination" 
              type="text" 
              placeholder="请输入目的地" 
              class="search-input"
            />
          </div>

          <!-- 入住日期 -->
          <div class="search-field date-field">
            <div class="field-icon">📅</div>
            <input 
              v-model="checkInDate" 
              type="date" 
              class="search-input"
            />
            <span class="date-label">入住</span>
          </div>

          <!-- 离店日期 -->
          <div class="search-field date-field">
            <div class="field-icon">📅</div>
            <input 
              v-model="checkOutDate" 
              type="date" 
              class="search-input"
            />
            <span class="date-label">离店</span>
          </div>

          <!-- 人数选择 -->
          <div class="search-field guest-field">
            <div class="field-icon">👥</div>
            <select v-model="guestCount" class="search-input">
              <option value="1">1人</option>
              <option value="2">2人</option>
              <option value="3">3人</option>
              <option value="4">4人</option>
            </select>
          </div>

          <!-- 搜索按钮 -->
          <button class="search-btn" @click="searchHotels">
            <span class="search-icon">🔍</span>
            <span class="search-text">搜索</span>
          </button>
        </div>

        <!-- 火车票筛选表单 -->
        <div v-if="searchType === 'train'" class="train-search-form">
          <!-- 顶部绿色指示条 -->
          <div class="train-indicator"></div>
          
          <!-- 出发和到达城市 -->
          <div class="train-cities-row">
            <div class="city-item departure-city" @click="() => {}">
              {{ departureCity }}
            </div>
            <div class="swap-icon" @click="swapCities">
              <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                <circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="1.5" fill="none"/>
                <path d="M9 12L12 9L15 12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
                <path d="M12 9V15" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
              </svg>
            </div>
            <div class="city-item arrival-city" @click="() => {}">
              {{ arrivalCity }}
            </div>
          </div>

          <!-- 日期和乘客信息 -->
          <div class="train-info-row">
            <div class="train-date-info" @click="() => {}">
              {{ formatTrainDate(trainDate) }}
            </div>
            <div class="train-passenger-info" @click="() => {}">
              <span>{{ adultCount }}成人 {{ childCount }}儿童</span>
              <span class="arrow-right">›</span>
            </div>
          </div>

          <!-- 火车类型和票务选项 -->
          <div class="train-options-row">
            <div class="train-option-item" @click="trainType = trainType === '高铁/动车' ? '普通列车' : '高铁/动车'">
              <div class="radio-button" :class="{ checked: trainType === '高铁/动车' }">
                <span v-if="trainType === '高铁/动车'" class="radio-dot"></span>
              </div>
              <span class="option-text">高铁/动车</span>
            </div>
            <div class="train-option-item" @click="isStudentTicket = !isStudentTicket">
              <div class="radio-button" :class="{ checked: isStudentTicket }">
                <span v-if="isStudentTicket" class="radio-dot"></span>
              </div>
              <span class="option-text">学生票</span>
            </div>
          </div>

          <!-- 火车票查询按钮 -->
          <div class="train-search-btn-container">
            <button class="train-search-btn" @click="searchTrains">
              火车票查询
            </button>
          </div>
        </div>
      </div>
    </section>

    <!-- 热门目的地推荐 -->
    <section class="hot-destinations">
      <div class="destinations-content">
        <h3 class="section-title">热门目的地</h3>
        <div class="destinations-grid">
          <div 
            v-for="destination in hotDestinations" 
            :key="destination.name"
            class="destination-item"
            @click="destination.name = destination.name"
          >
            <div class="destination-image">{{ destination.image }}</div>
            <div class="destination-info">
              <div class="destination-name">{{ destination.name }}</div>
              <div class="destination-price">{{ destination.price }}</div>
            </div>
          </div>
        </div>
      </div>
    </section>

    <!-- 优惠活动 -->
    <section class="promotions-section">
      <div class="promotions-content">
        <h3 class="section-title">优惠活动</h3>
        <div class="promotions-grid">
          <div 
            v-for="promotion in promotions" 
            :key="promotion.title"
            class="promotion-item"
            :style="{ backgroundColor: promotion.color }"
          >
            <div class="promotion-icon">{{ promotion.icon }}</div>
            <div class="promotion-info">
              <div class="promotion-title">{{ promotion.title }}</div>
              <div class="promotion-desc">{{ promotion.desc }}</div>
            </div>
          </div>
        </div>
      </div>
    </section>

    <!-- 服务保障区域 -->
    <section class="guarantee-section">
      <div class="guarantee-content">
        <h3 class="section-title">服务保障</h3>
        <div class="guarantee-grid">
          <div 
            v-for="guarantee in guarantees" 
            :key="guarantee.title"
            class="guarantee-item"
          >
            <div class="guarantee-icon">{{ guarantee.icon }}</div>
            <div class="guarantee-info">
              <div class="guarantee-title">{{ guarantee.title }}</div>
              <div class="guarantee-desc">{{ guarantee.desc }}</div>
            </div>
          </div>
        </div>
      </div>
    </section>

  </div>
</template>

<style scoped>
.tongcheng-homepage {
  min-height: 100vh;
  background: #f5f5f5;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* 顶部状态栏 */
.status-bar {
  background: #000;
  color: #fff;
  padding: 4px 0;
  font-size: 12px;
}

.status-content {
  max-width: 375px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
}

.location, .weather {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 顶部导航栏 */
.top-header {
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 375px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  height: 56px;
}

.logo-section {
  display: flex;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  font-size: 24px;
}

.logo-text {
  font-size: 18px;
  font-weight: 600;
  color: #1890ff;
}

.user-section {
  display: flex;
  align-items: center;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.default-avatar {
  width: 100%;
  height: 100%;
  background: #1890ff;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}

.user-name {
  font-size: 14px;
  color: #333;
  font-weight: 500;
}

.login-btn {
  background: #1890ff;
  color: white;
  border: none;
  border-radius: 16px;
  padding: 6px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

/* 功能分类导航 */
.category-nav {
  background: #fff;
  padding: 16px 0;
  border-bottom: 1px solid #e8e8e8;
}

.nav-content {
  max-width: 375px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 0 16px;
}

.category-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.2s;
}

.category-item:active {
  transform: scale(0.95);
}

.category-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
}

.category-name {
  font-size: 12px;
  color: #333;
  font-weight: 500;
}

/* 搜索区域 */
.search-section {
  background: #fff;
  padding: 20px 16px;
  border-bottom: 1px solid #e8e8e8;
}

.search-container {
  max-width: 375px;
  margin: 0 auto;
}

.search-tabs {
  display: flex;
  background: #f5f5f5;
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 16px;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: #1890ff;
  color: white;
}

.search-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  background: #f5f5f5;
  border-radius: 8px;
  padding: 12px;
}

.field-icon {
  font-size: 16px;
  margin-right: 8px;
  color: #666;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  color: #333;
  outline: none;
}

.search-input::placeholder {
  color: #999;
}

.date-field {
  position: relative;
}

.date-label {
  position: absolute;
  right: 12px;
  font-size: 12px;
  color: #666;
}

.search-btn {
  background: #1890ff;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.search-btn:active {
  background: #096dd9;
}

/* 火车票筛选表单样式 */
.train-search-form {
  background: #fff;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  position: relative;
}

.train-indicator {
  position: absolute;
  top: 0;
  left: 0;
  width: 60px;
  height: 3px;
  background: #4CAF50;
  border-radius: 0;
}

.train-cities-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px;
  border-bottom: 1px solid #f0f0f0;
}

.city-item {
  flex: 1;
  font-size: 18px;
  font-weight: 500;
  color: #000;
  cursor: pointer;
  text-align: center;
}

.departure-city {
  text-align: left;
}

.arrival-city {
  text-align: right;
}

.swap-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #666;
  border-radius: 50%;
  transition: all 0.2s;
  margin: 0 12px;
}

.swap-icon:hover {
  background: #f5f5f5;
  color: #1890ff;
}

.swap-icon:active {
  transform: rotate(180deg);
}

.train-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid #f0f0f0;
}

.train-date-info {
  font-size: 14px;
  color: #000;
  cursor: pointer;
  flex: 1;
}

.train-passenger-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #000;
  cursor: pointer;
  flex: 1;
  justify-content: flex-end;
}

.arrow-right {
  font-size: 20px;
  color: #999;
  font-weight: 300;
}

.train-options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
}

.train-option-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex: 1;
}

.radio-button {
  width: 18px;
  height: 18px;
  border: 2px solid #ddd;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.radio-button.checked {
  border-color: #1890ff;
}

.radio-dot {
  width: 10px;
  height: 10px;
  background: #1890ff;
  border-radius: 50%;
}

.option-text {
  font-size: 14px;
  color: #000;
}

/* 火车票查询按钮样式 */
.train-search-btn-container {
  padding: 20px 16px;
  background: #fff;
}

.train-search-btn {
  width: 100%;
  height: 50px;
  background: #4CAF50;
  border: none;
  border-radius: 25px;
  color: #fff;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.train-search-btn:hover {
  background: #45a049;
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
  transform: translateY(-1px);
}

.train-search-btn:active {
  background: #3d8b40;
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(76, 175, 80, 0.3);
}

/* 热门目的地样式 */
.hot-destinations {
  padding: 20px 0;
  background: #fff;
}

.destinations-content {
  max-width: 375px;
  margin: 0 auto;
  padding: 0 16px;
}

.destinations-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.destination-item {
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.2s;
}

.destination-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.destination-image {
  font-size: 28px;
  margin-bottom: 8px;
}

.destination-name {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.destination-price {
  font-size: 12px;
  color: #ff6b35;
  font-weight: 600;
}

/* 优惠活动样式 */
.promotions-section {
  padding: 20px 0;
}

.promotions-content {
  max-width: 375px;
  margin: 0 auto;
  padding: 0 16px;
}

.promotions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.promotion-item {
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.promotion-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.promotion-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
  pointer-events: none;
}

.promotion-icon {
  font-size: 24px;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.promotion-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  position: relative;
  z-index: 1;
}

.promotion-desc {
  font-size: 12px;
  opacity: 0.9;
  position: relative;
  z-index: 1;
}

/* 服务保障区域 */
.guarantee-section {
  background: #fff;
  padding: 20px 16px;
  margin-top: 8px;
}

.guarantee-content {
  max-width: 375px;
  margin: 0 auto;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin: 0 0 16px 0;
}

.guarantee-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.guarantee-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #f9f9f9;
  border-radius: 8px;
}

.guarantee-icon {
  font-size: 20px;
}

.guarantee-info {
  flex: 1;
}

.guarantee-title {
  font-size: 14px;
  font-weight: 500;
  color: #333;
  margin-bottom: 4px;
}

.guarantee-desc {
  font-size: 12px;
  color: #666;
}


/* 添加一些动画效果 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.category-item {
  animation: fadeInUp 0.6s ease-out;
}

.category-item:nth-child(1) { animation-delay: 0.1s; }
.category-item:nth-child(2) { animation-delay: 0.2s; }
.category-item:nth-child(3) { animation-delay: 0.3s; }
.category-item:nth-child(4) { animation-delay: 0.4s; }
.category-item:nth-child(5) { animation-delay: 0.5s; }
.category-item:nth-child(6) { animation-delay: 0.6s; }
.category-item:nth-child(7) { animation-delay: 0.7s; }
.category-item:nth-child(8) { animation-delay: 0.8s; }

.search-btn:hover {
  animation: pulse 1s infinite;
}

/* 添加滚动效果 */
.tongcheng-homepage {
  padding-bottom: 100px; /* 为底部导航留出空间 */
}

/* 优化搜索表单的视觉效果 */
.search-form {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-field {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  transition: all 0.2s;
}

.search-field:focus-within {
  border-color: #1890ff;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
}

/* 优化分类图标的悬停效果 */
.category-item:hover .category-icon {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 添加渐变背景 */
.tongcheng-homepage {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

/* 优化服务保障卡片 */
.guarantee-item {
  transition: all 0.2s;
  border: 1px solid #e8e8e8;
}

.guarantee-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: #1890ff;
}

/* 响应式设计 */
@media (max-width: 375px) {
  .status-content,
  .header-content,
  .nav-content,
  .search-container,
  .guarantee-content,
  .destinations-content,
  .promotions-content {
    max-width: 100%;
  }
  
  .nav-content {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
  
  .category-icon {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
  
  .guarantee-grid {
    grid-template-columns: 1fr;
  }
  
  .destinations-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .promotions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .search-form {
    padding: 12px;
  }
  
  .search-field {
    padding: 10px;
  }
}

/* 平板适配 */
@media (min-width: 768px) {
  .status-content,
  .header-content,
  .nav-content,
  .search-container,
  .guarantee-content,
  .destinations-content,
  .promotions-content {
    max-width: 768px;
  }
  
  .nav-content {
    grid-template-columns: repeat(8, 1fr);
  }
  
  .search-form {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 12px;
    align-items: end;
  }
  
  .search-btn {
    margin-top: 0;
    height: 48px;
  }
  
  .guarantee-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .destinations-grid {
    grid-template-columns: repeat(6, 1fr);
  }
  
  .promotions-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
</style>